package com.cn.serverline.lineicp.workshopPlan.controller;

import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import javax.annotation.Resource;

import com.cn.serverline.lineicp.workshopPlan.entity.PlanLineAutomaticTasks;
import com.cn.serverline.lineicp.workshopPlan.service.IPlanLineAutomaticTasksService;
import org.springframework.validation.annotation.Validated;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


/**
 * 周总排产结果表 接口
 *
 * @author 田江余
 * @since 2024-08-11
 */
@RestController
@ApiResource(name = "周总排产结果表的接口")
public class PlanLineAutomaticTasksController {

    @Resource(name = "PlanLineAutomaticTasksServiceImpl")
    private IPlanLineAutomaticTasksService iPlanLineAutomaticTasksService;

    /**
     * 自动排产
     * 添加周总排产结果表
     */
    @PostResource(name = "添加周总排产结果表", path = "/workshopPlan/planLineAutomaticTasks/add")
    public ResponseData<PlanLineAutomaticTasks> add(@RequestBody @Validated PlanLineAutomaticTasks planLineAutomaticTasks){
        iPlanLineAutomaticTasksService.add(planLineAutomaticTasks);
        return new SuccessResponseData<>();
    }

    /**
     * 删除周总排产结果表  撤回
     */
    @PostResource(name = "删除周总排产结果表", path = "/workshopPlan/planLineAutomaticTasks/delete")
    public ResponseData<?> delete(@RequestBody @Validated PlanLineAutomaticTasks  planLineAutomaticTasks){
        iPlanLineAutomaticTasksService.del(planLineAutomaticTasks);
        return new SuccessResponseData<>();
    }

    /**
     * 编辑周总排产结果表
     */
    @PostResource(name = "编辑周总排产结果表", path = "/workshopPlan/planLineAutomaticTasks/edit")
    public ResponseData<?> edit(@RequestBody @Validated PlanLineAutomaticTasks planLineAutomaticTasks) {
        iPlanLineAutomaticTasksService.edit(planLineAutomaticTasks);
        return new SuccessResponseData<>();
    }

    /**
     * 分页查询-周总排产结果表列表
     */
    @GetResource(name = "分页查询-周总排产结果表列表", path = "/workshopPlan/planLineAutomaticTasks/page")
    public ResponseData<PageResult<PlanLineAutomaticTasks>> page(PlanLineAutomaticTasks planLineAutomaticTasks) {
        return new SuccessResponseData<>(iPlanLineAutomaticTasksService.findPage(planLineAutomaticTasks));
    }

}
